//下载工具
var DownloadUtil = {
		
	Download:function(url,param,id){
		this.createIframe(id);
		
		var formId = this.createForm(url,param,id);
		
		$("#" +formId).submit();
	},
	
	createForm : function(url,param,id){
		var _id = "form_" + id;
		
		var _form = $("#" +_id);
		if(!_form[0]){
			_form = $("<form id=\""+_id+"\" name=\""+_id+"\" action=\""+url+"\" target=\"iframe_"+id+"\" method=\"post\" style=\"display:none;\"></form>");
			
			$("body").append(_form);
		}else{
			_form.empty();
		}
		
		if(param){
			for(var key in param){
				if(key && param[key]){
					var _input = $("<input name=\""+key+"\" />").val(param[key]);
					_form.append(_input);
				}
			}
		}
		
		return _id;
	},
	
	createIframe : function(id){
		var _id = "iframe_" + id;
		if(!$("#" +_id)[0]){
			var iframe = $("<iframe id=\""+_id+"\" name=\""+_id+"\"></iframe>");
			$("body").append(iframe);
			iframe.hide();
		}
	}

	
}

